package UnitTest.DataStructureTest.treeTest.binaryTreeTest.binaryTreeApplyTest;

import DataStructure.tree.binaryTree.binaryTreeApply.BT_MirrorOperation;
import DataStructure.tree.binaryTree.binaryTreeImpl.BinaryTreeImpl;
import TestData.DataStructureTestData.treeTestData.binaryTreeTestData.BinaryTreeBuildDemo;
import TestData.DataStructureTestData.treeTestData.binaryTreeTestData.BinaryTreeTestDemo;
import org.junit.Test;

/**
 * @author liujun
 * @date 2020-02-20 10:17
 * @description  镜像二叉树 测试案例
 * Test of Mirror BinaryTree
 */
public class BT_MirrorOperationTest extends BinaryTreeTestDemo {

    BT_MirrorOperation binaryTreeMirrorOperation = new BT_MirrorOperation();

    @Test
    public void testMirror() {
        //null
        assert binaryTreeMirrorOperation.equals(binaryTreeImplDemo1, binaryTreeMirrorOperation.Mirror(binaryTreeImplDemo1));
        //empty BinaryTreeImpl
        assert binaryTreeMirrorOperation.equals(new BinaryTreeImpl(), binaryTreeMirrorOperation.Mirror(new BinaryTreeImpl()));

        binaryTreeImplDemo3 = BinaryTreeBuildDemo.getBinaryTreeDemo3();
        assert binaryTreeMirrorOperation.equals(BinaryTreeBuildDemo.getBinaryTreeDemo3_Mirror(), binaryTreeMirrorOperation.Mirror(binaryTreeImplDemo3));
        binaryTreeImplDemo4 = BinaryTreeBuildDemo.getBinaryTreeDemo4();
        assert binaryTreeMirrorOperation.equals(BinaryTreeBuildDemo.getBinaryTreeDemo4_Mirror(), binaryTreeMirrorOperation.Mirror(binaryTreeImplDemo4));
    }

    @Test
    public void testMirrorByStack() {
        //null
        assert binaryTreeMirrorOperation.equals(binaryTreeImplDemo1, binaryTreeMirrorOperation.MirrorByStack(binaryTreeImplDemo1));
        //empty BinaryTreeImpl
        assert binaryTreeMirrorOperation.equals(new BinaryTreeImpl(), binaryTreeMirrorOperation.MirrorByStack(new BinaryTreeImpl()));

        binaryTreeImplDemo3 = BinaryTreeBuildDemo.getBinaryTreeDemo3();
        assert binaryTreeMirrorOperation.equals(BinaryTreeBuildDemo.getBinaryTreeDemo3_Mirror(), binaryTreeMirrorOperation.MirrorByStack(binaryTreeImplDemo3));
        binaryTreeImplDemo4 = BinaryTreeBuildDemo.getBinaryTreeDemo4();
        assert binaryTreeMirrorOperation.equals(BinaryTreeBuildDemo.getBinaryTreeDemo4_Mirror(), binaryTreeMirrorOperation.MirrorByStack(binaryTreeImplDemo4));
    }



}
